Add http route to outgoing http requests, if available #5129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
We have a large mono repo and our app users have the need for the following usage:
Since our users are tracking SLOs for their services for different endpoints, they need histograms observations to include the path tempate. This path template comes from
mappersmith
and we take care of setting it ourselves, as can be seen above. Yes, it is a bit hacky, this path template is sent via a header, but that's our problem. 😬 It's good enough for us for now at least.But we need to patch opentelemetry to read it and put it in the histogram observation, hence the PR.
Short description of the changes
Ensure that
'http.route'
makes it to metric attributes, if it is available from the span attribute.Type of change
Please delete options that are not relevant.
I hesitate to check breaking. If someone today is also setting
SEMATTRS_HTTP_ROUTE
instartOutgoingSpanHook
and NOT expecting it to result in a new label in prometheus metrics, I guess that's a unexpected. But not breaking.How Has This Been Tested?
We have had this code running in production for 1 month.
Checklist: